using System.Windows.Forms;

namespace Nuwanda.TfsSpotlight
{
  partial class TfsSpotlightApplication
  {
      private void SetUpCommands()
      {
          this.MenuService.RegisterCommand(CommandsNames.ExitApplication)
              .Name("Exit")
              .Image(Properties.Resources.Exit)
              .Shortcut(Keys.F10)
              .AlwaysActive()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.OpenAboutWindow)
              .Name("About")
              .Image(Properties.Resources.Help)
              .AlwaysActive()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.OpenSettings)
              .Name("Settings")
              .Image(Properties.Resources.Settings)
              .AlwaysActive()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.CreateWorkItem)
              .Name("Create work item")
              .Image(Properties.Resources.Create)
              .Shortcut(Keys.Control | Keys.N)
              .AlwaysActive()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.AutoConnect)
              .AlwaysActive()
              .Asynchronous()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.Save)
              .Name("Save")
              .Image(Properties.Resources.Saving)
              .Shortcut(Keys.Control | Keys.S)
              .Asynchronous()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.Refresh)
              .Name("Refresh")
              .Image(Properties.Resources.Refresh)
              .Shortcut(Keys.F5)
              .Asynchronous()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.CopyWorkItemIdToClipboard)
              .Shortcut(Keys.Control | Keys.W)
              .AlwaysActive()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.Load)
              .AlwaysActive()
              .Asynchronous()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.RestartApplication)
              .AlwaysActive()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.GoToNextWorkItem)
              .Name("Next")
              .Image(Properties.Resources.Next)
              .Asynchronous()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.GoToPreviousWorkItem)
              .Name("Previous")
              .Image(Properties.Resources.Previous)
              .Asynchronous()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.RefreshWorkItem)
              .Name("Refresh")
              .Image(Properties.Resources.Refresh)
              .Shortcut(Keys.Shift | Keys.F5)
              .Asynchronous()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.SaveAllWorkItems)
              .Name("Save all")
              .Image(Properties.Resources.Saving)
              .Shortcut(Keys.Shift | Keys.Control | Keys.S)
              .Asynchronous()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.ActivateGoToWorkItemBox)
              .Shortcut(Keys.Control | Keys.G)
              .AlwaysActive()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.ToggleProjectsPane)
              .Shortcut(Keys.F4)
              .AlwaysActive()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.ToggleHistoryPanel)
              .Shortcut(Keys.Control | Keys.H)
              .AlwaysActive()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.GoToWorkItem)
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.OpenWorkItem)
              .AlwaysActive()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.SearchWorkItemsByTitle)
              .AlwaysActive()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.LoadWorkItem)
              .AlwaysActive()
              .Asynchronous()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.RefreshHistory)
              .AlwaysActive()
              .Asynchronous()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.OpenWorkItemFromHistory)
              .AlwaysActive()
              .Asynchronous()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.Connect)
              .Name("Connect")
              .Image(Properties.Resources.Connect1)
              .Asynchronous()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.Disconnect)
              .Name("Disconnect")
              .Image(Properties.Resources.Disconnect)
              .Asynchronous()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.Reconnect)
              .Name("Reconnect")
              .Image(Properties.Resources.Reconnect)
              .Asynchronous()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.OpenChart)
              .Name("View chart")
              .Image(Properties.Resources.Chart)
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.RunQuery)
              .Name("Run")
              .Image(Properties.Resources.Start)
              .AlwaysActive()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.ClearHistory)
              .Name("Clear all")
              .Image(Properties.Resources.ClearHistory)
              .AlwaysActive()
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.RefreshProjects)
              .Name("Refresh projects")
              .Image(Properties.Resources.Project)
              .Commit();

          this.MenuService.RegisterCommand(CommandsNames.OpenBuild)
              .Name("View builds")
              .Image(Properties.Resources.BuildType)
              .Commit();
          this.MenuService.RegisterCommand(CommandsNames.StartBuild)
              .Name("Start")
              .Image(Properties.Resources.QueueBuild)
              .Commit();


          this.MenuService.ConfigureToolStrip()
              .AlignRight(CommandsNames.ExitApplication)
              .AlignRight(CommandsNames.OpenAboutWindow)
              .AlignRight(CommandsNames.OpenSettings)
              .AlignLeft(CommandsNames.CreateWorkItem)
              .AddLeftSeparator()
              .AlignLeft(CommandsNames.Refresh)
              .AddLeftSeparator()
              .AlignLeft(CommandsNames.GoToPreviousWorkItem)
              .AlignLeft(CommandsNames.GoToNextWorkItem)
              .AlignLeft(CommandsNames.Save)
              .AlignLeft(CommandsNames.SaveAllWorkItems)
              .AlignLeft(CommandsNames.RefreshWorkItem)
              .AddLeftSeparator()
              .AlignLeft(CommandsNames.OpenChart);

          this.LeftSideBar.ConfigureToolStrip()
              .Style(ToolStripItemDisplayStyle.ImageAndText)
              .Composition(TextImageRelation.ImageBeforeText)
              .AlignLeft(CommandsNames.Connect)
              .Style(ToolStripItemDisplayStyle.Image)
              .AlignLeft(CommandsNames.Reconnect)
              .AlignLeft(CommandsNames.Disconnect)
              .AddLeftSeparator()
              .Style(ToolStripItemDisplayStyle.ImageAndText)
              .AlignLeft(CommandsNames.RefreshProjects);

          this.RightSidebar.ConfigureToolStrip()
              .Style(ToolStripItemDisplayStyle.ImageAndText)
              .Composition(TextImageRelation.ImageBeforeText)
              .AlignLeft(CommandsNames.ClearHistory);

          this.MenuService.ConfigureContextMenu(ContextMenusNames.Query)
              .Command(CommandsNames.RunQuery);
              //.Command(CommandsNames.OpenChart);

          this.MenuService.ConfigureContextMenu(ContextMenusNames.Server)
              .Command(CommandsNames.Connect)
              .Command(CommandsNames.Reconnect)
              .Command(CommandsNames.Disconnect)
              .Command(CommandsNames.RefreshProjects);

          this.MenuService.ConfigureContextMenu(ContextMenusNames.Build)
              .Command(CommandsNames.OpenBuild);
              //.Command(CommandsNames.StartBuild);

          this.MenuService.ConfigureContextMenu(ContextMenusNames.Project)
              .Command(CommandsNames.CreateWorkItem);
      }
  }
}